import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    redirect: "/goodslist",
  },
  {
    path: "/index",
    name: "index",

    component: () => import("../views/Index.vue"),
    children: [
      {
        path: "/goods",
        name: "goods",

        component: () => import("../views/Goods.vue"),
        meta: {
          title: "商品管理",
        },
      },
      {
        path: "/goodslist",
        name: "goodslist",

        component: () => import("../views/GoodsList.vue"),
        meta: {
          title: "商品列表",
        },
      },
      {
        path: "/shopcar",
        name: "shopcar",

        component: () => import("../views/Shopcar.vue"),
        meta: {
          title: "购物车列表",
        },
      },
    ],
  },
];

const router = new VueRouter({
  routes,
});

export default router;
